package huoye.shops.huoye.home.networt;


import com.codeideology.android.http.okhttp.OkHttpUtils;
import com.codeideology.android.rpc.BaseJsonRequestCallback;

import java.util.HashMap;
import java.util.Map;

import huoye.shops.base.APIUrls;
import huoye.shops.base.BaseService;
import huoye.shops.base.MineBaseJsonRequestCallback;
import huoye.shops.base.UserManager;
import huoye.shops.huoye.home.model.MerchantCenter;
import huoye.shops.huoye.home.model.ValidateMsg;
import huoye.shops.huoye.operation.model.ObtainShopType;
import huoye.shops.huoye.user.model.User;


/**
 * Created by user on 2017/7/24.
 */

public class HomeService extends BaseService {


    /**
     *   商家管理后台主页
     * @param type
     * @param callback
     */
    public void postMerchantCenter(String type,MineBaseJsonRequestCallback<MerchantCenter> callback) {

        Map<String, String> param = new HashMap<>();

        setUser(param);
        param.put("dataType", type);


        OkHttpUtils.getInstance().post()
                .url(getUrl(APIUrls.HOME.TYPE_HOME_MERCHANT_CENTER))
                .params(param)
                .build().execute(callback);


    }


/**
     *   核销接口
     * @param type
 *     @param itemId
 *     @param userId
 *     @param num
     * @param callback
     */
    public void postValidateAll(String type,String itemId,String userId,String num,MineBaseJsonRequestCallback<ValidateMsg> callback) {

        Map<String, String> param = new HashMap<>();

        setUser(param);
        param.put("type", type);
        param.put("itemId", itemId);
        param.put("userId",userId);
        param.put("num",num);


        String optionId = UserManager.getInstance().getUserId();
        param.put("optionId", optionId);


        OkHttpUtils.getInstance().post()
                .url(getUrl(APIUrls.HOME.TYPE_HOME_MERCHANT_VALIDATE_ALL))
                .params(param)
                .build().execute(callback);


    }




}


